
Rem
	Returns an array of strings, each of which is a substring of string formed by
	splitting it on boundaries formed by the string delimiter. 
	
	@author	Nicholas Grant
	@updatedby	
	@param	string	delimiter
	@param	string	str
	@param	int		limit = 0
	@variable	string[]	splitStringSplits
	@variable	string[]	returnStringArray
	@return	string array
EndRem
Function explode:String[] ( delimiter:String, str:String, limit:Int = 0 )
	
	Local splitStringSplits:String[] = str.Split( delimiter );	
	Local returnStringArray:String[];
	
	If ( Not limit )
		returnStringArray = splitStringSplits;
	Else
		
		returnStringArray = New String[limit];
		For Local cnt:Int = 0 To limit - 1
			
			If ( cnt < limit - 1 )
				returnStringArray[cnt] = splitStringSplits[cnt];
			Else
				
				For Local cnt2:Int = cnt To splitStringSplits.Length - 1
					
					If ( cnt2 < splitStringSplits.Length - 1 )
						returnStringArray[cnt] :+ splitStringSplits[cnt2] + delimiter;
					Else
						returnStringArray[cnt] :+ splitStringSplits[cnt2];
					End If
					
				Next
				
			End If
			
		Next
		
	End If
	
	Return returnStringArray
	
End Function